package com.property.controller;

import com.alibaba.fastjson.JSON;
import com.property.pojo.Car;
import com.property.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("car")
public class CarController {
    @Autowired
    private CarService carService;

    @RequestMapping("findAll")
    public String findAll(Integer page){
        return carService.findAllCar(page);
    }

    //新增车位信息
    @RequestMapping("saveCar")
    public String saveCar(Car car,String rName){
        return carService.saveCar(car,rName);
    }

    //通过id查询车位信息
    @RequestMapping("findCarBycId")
    public String findCarBycId(Integer cId){
        return carService.findCarBycId(cId);
    }

    //删除车位信息
    @RequestMapping("deleteCar")
    public String deleteCar(Integer cId){
        return carService.deleteCar(cId);
    }
}
